package easy

/*
时间复杂度:O(N)
空间复杂度:O(C) 字母总数
*/

func canConstruct(ransomNote string, magazine string) bool {
	var arr [26]int
	for _, ch := range magazine {
		arr[ch-'a']++
	}
	for _, ch := range ransomNote {
		arr[ch-'a']--
		if arr[ch-'a'] < 0 {
			return false
		}
	}
	return true
}